<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('人员不良行为登记')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>关键字：</p>
                                <input type="text" name="keyword"/>
                            </li>
                            <li>
							状态：<select name="state" th:with="type=${@dict.getType('sys_normal_disable')}">
							            <option value="">全部</option>
										<option value="未上报">未上报</option>
										<option value="已上报">已上报</option>
										<option value="审核通过">已通过</option>
										<option value="审核退回">已退回</option>
								   </select>
								</li>  
                            <li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
            	<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="integrityInformationAdd:personBadBehavior:add">
		             <i class="fa fa-plus"></i> 添加
		        </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                 <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:src="@{/js/plugins/datetime/moment.js}"></script>
    <script th:inline="javascript">
    var wsbeditxwFlag = [[${@permission.hasPermi('integrityInformationAdd:personBadBehavior:wsbeditxw')}]];
    var wsbeditcxFlag = [[${@permission.hasPermi('integrityInformationAdd:personBadBehavior:wsbeditcx')}]];
    var ysbdetailFlag = [[${@permission.hasPermi('integrityInformationAdd:personBadBehavior:ysbdetail')}]];
    var ysbapprovalxwFlag = [[${@permission.hasPermi('integrityInformationAdd:personBadBehavior:ysbapprovalxw')}]];
    var ysbapprovalcxFlag = [[${@permission.hasPermi('integrityInformationAdd:personBadBehavior:ysbapprovalcx')}]];
    var passdetaiFlag = [[${@permission.hasPermi('integrityInformationAdd:personBadBehavior:passdetai')}]];
    var passcxFlag = [[${@permission.hasPermi('integrityInformationAdd:personBadBehavior:passcx')}]];
    var returndetaiFlag = [[${@permission.hasPermi('integrityInformationAdd:personBadBehavior:returndetai')}]];
    var returnzgdjFlag = [[${@permission.hasPermi('integrityInformationAdd:personBadBehavior:returnzgdj')}]];
    
    var prefix = ctx + "integrityInformationAdd/peopleBehavior";
    
    $(function() {
    	 var options = {
    			url: prefix + "/peopleBadBehaviorList",
                createUrl: prefix + "/peopleBadBehaviorAdd",
                updateUrl: prefix + "/editPeopleBadBehavior/{id}",
                updateUrlRewriteOne: prefix + "/peopleBadBehaviorApprove/{id}",
                updateUrlRewriteTwo: prefix + "/peopleBadBehaviorUndoAdd/{id}",
                updateUrlRewriteThree: prefix + "/editPeopleBadBehaviorUndo/{id}",
                updateUrlRewriteFour: prefix + "/peopleBadBehaviorUndoApprove/{id}",
                updateUrlRewriteFive: prefix + "/peopleBadBehaviorRect/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                detailUrl: prefix + "/peopleBadBehaviorDetail/{id}",
                modalName: "人员不良行为登记",
                columns: [
					{
                        field: 'id',
                        title: '序号',
						formatter: function (value, row, index) {
						
						    return index + 1;
						}
                    },
                    {
                        field: 'guid',
                        title: '标识符',
						visible: false
	                }, 
					{
                        field: 'description',
                        title: '行为描述'
                    },
                    {
                        field: 'personnalPoorInfoEntity',
                        title: '姓名',
						width:80,
                        formatter: function (value, row, index) {
	                            return value.personName;
						}
                    },
                    {
                        field: 'personnalPoorInfoEntity',
                        title: '证件号码',
                        formatter: function (value, row, index) {
	                            return value.certNumber;
						}
                    },
                    {
                        field: 'personnalPoorInfoEntity',
                        title: '工程名称',
                        formatter: function (value, row, index) {
	                            return value.projectName;
						}
                    },
                    {
                        field: 'personnalPoorInfoEntity',
                        title: '处罚机构',
                        formatter: function (value, row, index) {
	                            return value.punishmentDept;
						}
                    },
                    {
                        field: 'reportDate',
                        title: '申请日期',
						width:80,
						formatter: function (value, row, index) {
							if($.common.isNotEmpty(value)){
								var strDate = value;
								value =  moment(strDate,'YYYY-MM-DD').format('YYYY-MM-DD');	
							}
							return value;
						}
                    },
					{
                        field: 'pubDate',
                        title: '添加日期',
						formatter: function (value, row, index) {
							if($.common.isNotEmpty(value)){
								var strDate = value;
								value =  moment(strDate,'YYYY-MM-DD').format('YYYY-MM-DD');	
							}
							return value;
						},
						visible: false
                    },
                    {
                        field: 'state',
                        title: '状态',
						width:70
                    },
					{
                        field: 'applyWay',
                        title: '申请方式 登记、撤销',
						visible: false
                    },
					{	
                        field: 'personnalPoorInfoEntity',
                        title: '撤销申请时间',
                        formatter: function (value, row, index) {
	                            return value.undoApplyDate;
						},
						visible: false
                    },
					{
	                    field: 'opera',
	                    title: '功能区',
                        formatter: function (value, row, index) {
                            var actions = [];
							if(row.state == '未上报'){
								/* actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.guid + '\')"><i class="fa fa-edit"></i>编辑</a> '); */
								if(row.applyWay == '登记'){
									actions.push('<a class="btn btn-success btn-xs ' + wsbeditxwFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.guid + '\')"><i class="fa fa-edit"></i>编辑行为登记</a> ');
								}else if(row.applyWay == '撤销'){
									actions.push('<a class="btn btn-success btn-xs ' + wsbeditcxFlag + '" href="javascript:void(0)" onclick="$.operate.editTabRewriteThree(\'编辑' + row.personnalPoorInfoEntity.personName + '不良行为撤销申请\',\''+ row.guid +'\')"><i class="fa fa-edit"></i>编辑撤销申请</a> ');
								}
							}else if(row.state == '已上报'){
								actions.push('<a class="btn btn-warning btn-xs ' + ysbdetailFlag + '" href="javascript:void(0)" onclick="$.operate.detailQYTabRewrite(\'' + row.guid + '\',\''+ row.personnalPoorInfoEntity.personName + row.applyWay +'\')"><i class="fa fa-search"></i>详情</a> ');
								if(row.applyWay == '登记'){
									actions.push('<a class="btn btn-success btn-xs ' + ysbapprovalxwFlag + '" href="javascript:void(0)" onclick="$.operate.editTabRewriteOne(\'' + row.personnalPoorInfoEntity.personName + '不良行为\',\''+ row.guid +'\')"><i class="fa fa-edit"></i>审批行为登记</a> ');
								}else if(row.applyWay == '撤销'){
									actions.push('<a class="btn btn-success btn-xs ' + ysbapprovalcxFlag + '" href="javascript:void(0)" onclick="$.operate.editTabRewriteFour(\'审批' + row.personnalPoorInfoEntity.personName + '不良行为撤销申请\',\''+ row.guid +'\')"><i class="fa fa-edit"></i>审批撤销申请</a> ');
								}
							}else if(row.state == '审核通过'){
								actions.push('<a class="btn btn-warning btn-xs ' + passdetaiFlag + '" href="javascript:void(0)" onclick="$.operate.detailQYTabRewrite(\'' + row.guid + '\',\''+ row.personnalPoorInfoEntity.personName + row.applyWay +'\')"><i class="fa fa-search"></i>详情</a> ');
								if(row.applyWay == '登记' && $.common.isEmpty(row.personnalPoorInfoEntity.undoApplyDate)){
									actions.push('<a class="btn btn-success btn-xs ' + passcxFlag + '" href="javascript:void(0)" onclick="$.operate.editTabRewriteTwo(\'' + row.personnalPoorInfoEntity.personName + '不良行为撤销申请\',\''+ row.guid +'\')"><i class="fa fa-edit"></i>撤销申请</a> ');
								}
							}else if(row.state == '审核退回'){
								actions.push('<a class="btn btn-warning btn-xs ' + returndetaiFlag + '" href="javascript:void(0)" onclick="$.operate.detailQYTabRewrite(\'' + row.guid + '\',\''+ row.personnalPoorInfoEntity.personName + row.applyWay +'\')"><i class="fa fa-search"></i>详情</a> ');
								if(row.applyWay == '登记'){
									actions.push('<a class="btn btn-success btn-xs ' + returnzgdjFlag + '" href="javascript:void(0)" onclick="$.operate.editTabRewriteFive(\'整改' + row.personnalPoorInfoEntity.personName + '不良行为登记申请\',\''+ row.guid +'\')"><i class="fa fa-edit"></i>整改登记</a> ');
								}else if(row.applyWay == '撤销'){
									/* actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.editTabRewriteSix(\'整改' + row.personnalPoorInfoEntity.personName + '良好行为撤销申请\',\''+ row.guid +'\')"><i class="fa fa-edit"></i>整改撤销</a> '); */
								}
							}
                            return actions.join('');
	                       }
	                }]
        };
    	$.table.init(options);
    });
    </script>
</body>
</html>